﻿<UserControl x:Class="XDraw.Controls.LinearGradientBrushEditor"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:xdCtrl="clr-namespace:XDraw.Controls"
             mc:Ignorable="d" 
             Loaded="UserControl_Loaded">

  <DockPanel DataContext="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}, Path=Brush}">
    <xdCtrl:GradientStopEditor DockPanel.Dock="Bottom" Height="120" Margin="0,2,0,0"
                               GradientStops="{Binding Path=GradientStops}"/>
    
    <Slider DockPanel.Dock="Right" Orientation="Vertical" Minimum="0.0" Maximum="2.0" Margin="2,0,0,0" IsDirectionReversed="True"
            Value="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}, Path=OuterSpace}"/>
    
    <Canvas SizeChanged="Canvas_SizeChanged" x:Name="Canvas" MinWidth="200" MinHeight="200">
      <Rectangle Stroke="Black" StrokeThickness="1" x:Name="OuterBorder"/>
      <Rectangle Stroke="Black" StrokeThickness="1" Fill="{Binding}" x:Name="InnerBorder"/>

      <Line Stroke="DarkGray" StrokeThickness="1" x:Name="StartEndLine"/>

      <Ellipse Width="10" Height="10" Fill="#7fffffff" Stroke="Blue" StrokeThickness="1" x:Name="StartPoint"
               ToolTip="Start point"
               MouseLeftButtonDown="Point_MouseLeftButtonDown"
               MouseLeftButtonUp="Point_MouseLeftButtonUp"
               MouseMove="Point_MouseMove"/>
      <Ellipse Width="10" Height="10" Fill="#7fffffff" Stroke="Blue" StrokeThickness="1" x:Name="EndPoint"
               ToolTip="End point"
               MouseLeftButtonDown="Point_MouseLeftButtonDown"
               MouseLeftButtonUp="Point_MouseLeftButtonUp"
               MouseMove="Point_MouseMove"/>
    </Canvas>
  </DockPanel>
</UserControl>
